package com.ywu.role.standard.api;

import com.ywu.common.result.CommonResult;
import com.ywu.role.standard.dto.MenuRoleAuthDto;
import com.ywu.role.standard.dto.MenuRoleAuthPermissionDto;
import com.ywu.role.standard.service.MenuRoleAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName MenuRoleAuthApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2024/5/29 21:30
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/role/auth")
public class MenuRoleAuthApi {
    @Autowired
    private MenuRoleAuthService menuRoleAuthService;

    /**
     * @Author GroundDemo
     * @Description 查询菜单关联的角色
     * @Date 22:01 2024/3/9
     * @Param [menuRoleAuthDto]
     * @return com.ywu.common.result.CommonResult<java.lang.Object>
     **/
    @PostMapping("/menu.role.info")
    public CommonResult<Object> queryMenuRoleInfo(@RequestBody MenuRoleAuthDto menuRoleAuthDto) {
        return menuRoleAuthService.queryMenuRoleInfo(menuRoleAuthDto);
    }

    /**
     * @Author GroundDemo
     * @Description 菜单角色授权管理
     * @Date 22:12 2024/3/9
     * @Param [dto]
     * @return com.ywu.common.result.CommonResult<java.lang.Object>
     **/
    @PostMapping("/menu.role.auth.create.info")
    public CommonResult<Object> menuRoleAuthCreateInfo(@RequestBody MenuRoleAuthPermissionDto dto) {
        return menuRoleAuthService.menuRoleAuthCreateInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除菜单的授权
    * @Date 19:14 2025/3/26
    * @Param [menuRoleAuthDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/menu.role.auth.delete.info")
    public CommonResult<Object> menuRoleAuthDeleteInfo(@RequestBody MenuRoleAuthDto menuRoleAuthDto) {
        return menuRoleAuthService.menuRoleAuthDeleteInfo(menuRoleAuthDto);
    }
}
